﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace InstantSpine.Core.MaterialModels
{
    /// <summary>
    /// Hydraulic fluid material model
    /// </summary>
    [DataContract]
    public sealed class HydraulicFluidMaterial: MaterialViewModel
    {
        private double? bulkModulus;
        private double? density;

        // read/write for two-way binding
        /// <summary>
        /// Bulk modulus (inverse of compressibility)
        /// </summary>
        [DataMember]
        public double? BulkModulus { 
            get { return bulkModulus; }
            set {
                if (bulkModulus != value) {
                    bulkModulus = value;
                    OnPropertyChanged();
                }
            }
        }

        // read/write for two-way binding
        /// <summary>
        /// Mass density
        /// </summary>
        [DataMember]
        public double? Density {
            get { return density; }
            set {
                if (density != value) {
                    density = value;
                    OnPropertyChanged();
                }
            }
        }
        
        public HydraulicFluidMaterial(double density, double bulkModulus, string name): base(name) {
            this.density = density;
            this.bulkModulus = bulkModulus;            
        }

        public HydraulicFluidMaterial(string name = ""): base(name) {
            this.density = null;
            this.bulkModulus = null;
        }

        // required for XML serialization to work
        public HydraulicFluidMaterial() : this("") { }
    }
}
